package euler;

import euler.LaFonction.OutPut;
import java.util.ArrayList;
import java.util.List;

public class LaFonction extends ArrayList<OutPut> {

    public class OutPut {

        int Z;
        int f_Z;

        public OutPut(int Z, int f_Z) {
            this.Z = Z;
            this.f_Z = f_Z;
        }

        @Override
        public String toString() {
            return "(" + Z + "," + f_Z + ")";
        }
    }

    public LaFonction(int n) {

        for (int Z = n ; Z >= 2 ; Z--) {
            add(new OutPut(Z, calculate(Z)));
        }

    }

    public int calculate(int Z) {//méthode idiote !
        int ret = 0;
        List<Integer> phi = new Phi(Z).intValues();
        for (Integer I : phi) {
            ret += I;
        }
        return ret;
    }
}
